@extends('admin.layout.common')
@section('content')
	<link rel="stylesheet" href="{{URL('css/app.css')}}">
	<link rel="stylesheet" href="{{URL('css/finance/FinancePayment.css')}}">
	<style>
		.pagination{float:right;margin-top:10px;width:20%}
		.pagination>li>a, .pagination>li>span{color: #d0141d
		}
		.pagination .active span{background-color: #d0141d;border-color: #d0141d
		}
		.red_icon{color:red}
	</style>
		<div class="content">
			<h1 class="h1">财务支付中心</h1>
			<!-- 公共结束 -->
			<p class="p1">
                <form action="financePayment" method="get">
                    {{csrf_field()}}
                        <input id="action" type="hidden" name="action" value="">
                        <label for="" style="margin-left:10px;">结算人：
                            <input type="text" placeholder="请输入姓名" name="name">
                        </label>
                        <button type="submit" style="margin-left:20px;">查找</button>
                        <button type="button" style="float:right;" onclick="location.href='{{url('/admin/financePaymentToExcel')}}'">导出Excel</button>
                </form>
			</p>
			<div class="ul_box">
				<ul class="ul" id="div1" style="display:block;">
					<li class="active musician"><span>音乐人列表</span></li>
					<li class="agency"><span>代理列表</span></li>
				</ul>
				<div class="ul_right">
					<div class="select_ul">
						<ul class="accomplish"  style="display:block;">
							<li class="show" onclick="changeAction('music_action1')">
								<p>{{$financeCount['alwayscount1']}}</p>
								<p>已完成提现</p>
							</li>
							<li onclick="changeAction('music_action2')">
								<p>{{$financeCount['applycount1']}}</p>
								<p>已申请提现</p>
							</li>
							<li onclick="changeAction('music_action3')">
								<p>{{$financeCount['nocount1']}}</p>
								<p>当前未提现</p>
							</li>
							<li onclick="changeAction('music_action4')">
								<p>{{$financeCount['nocount1']}}</p>
								<p>应备备用金</p>
							</li>
						</ul>
						<ul  class="accomplish_2">
							<li class="present" onclick="changeAction('agency_action1')">
								<p>{{$financeCount['alwayscount2']}}</p>
								<p>已完成提现</p>
							</li>
							<li onclick="changeAction('agency_action2')">
								<p>{{$financeCount['applycount2']}}</p>
								<p>已申请提现</p>
							</li>
							<li onclick="changeAction('agency_action3')">
								<p>{{$financeCount['nocount2']}}</p>
								<p>当前未提现</p>
							</li>
							<li onclick="changeAction('agency_action4')">
								<p>{{$financeCount['nocount2']}}</p>
								<p>应备备用金</p>
							</li>
						</ul>
					</div>
					<div class="div1">
						<div >
							<table border="1">
								<tr>
									<th>账单ID</th>
									<th>收款人</th>
									<th>收款账户</th>
									<th>已提现金额</th>
									<th>提现时间</th>
									<th>处理时间</th>
								</tr>
								@foreach($alwayslist1 as $v)
								<tr>
									<td>{{$v->id}}</td>
									<td>{{$v->name}}</td>
									<td>{{$v->band_card}}</td>
									<td>{{$v->money}}</td>
									<td>{{$v->created_at}}</td>
									<td>{{$v->deal_time}}</td>
								</tr>
								@endforeach
							</table>
							{{ $alwayslist1->links()}}
						</div>
						<div>
							<table border="1">
								<tr>
									<th>账单ID</th>
									<th>收款人</th>
									<th>收款账户</th>
									<th>开户行</th>
									<th>申请提现金额</th>
									<th>提现时间</th>
								</tr>
								@foreach($applylist1 as $v)
								<tr>
									<td>{{$v->id}}</td>
									<td>{{$v->name}}</td>
									<td>{{$v->band_card}}</td>
									<td>{{$v->band_info}}</td>
									<td>{{$v->money}}</td>
									<td>{{$v->created_at}}</td>
								</tr>
								@endforeach
							</table>
							{{ $applylist1->links()}}
							<p><input type="button" value="批量付款" class="piliang"  onclick="batchMusic()"></p>
						</div>
						<div>
							<table border="1">
								<tr>
									<th>账单ID</th>
									<th>收款人</th>
									<th>收款账户</th>
									<th>账户余额</th>
								</tr>
								@foreach($nolist1 as $v)
								<tr>
									<td>{{$v->id}}</td>
									<td>{{$v->payee_name}}</td>
									<td>{{$v->band_card}}</td>
									<td>{{$v->money}}</td>
								</tr>
								@endforeach
							</table>
							{{ $nolist1->links()}}
						</div>
						<div>
							<table border="1">
								<tr>
									<th>账单ID</th>
									<th>收款人</th>
									<th>收款账户</th>
									<th>账户余额</th>
								</tr>
								@foreach($nolist1 as $v)
								<tr>
									<td>{{$v->id}}</td>
									<td>{{$v->payee_name}}</td>
									<td>{{$v->band_card}}</td>
									<td>{{$v->money}}</td>
								</tr>
								@endforeach
							</table>
							{{ $nolist1->links()}}
						</div>
					</div>
					<div class="div2" id="tablebox3_2"  style="display:none;">
						<div>
							<table border="1">
								<tr>
									<th>账单ID</th>
									<th>收款人</th>
									<th>收款账户</th>
									<th>已提现金额</th>
									<th>提现时间</th>
									<th>处理时间</th>
								</tr>
								@foreach($alwayslist2 as $v)
								<tr>
									<td>{{$v->id}}</td>
									<td>{{$v->name}}</td>
									<td>{{$v->band_card}}</td>
									<td>{{$v->money}}</td>
									<td>{{$v->created_at}}</td>
									<td>{{$v->deal_time}}</td>
								</tr>
								@endforeach
							</table>
							{{ $alwayslist2->links()}}
						</div>
						<div>
							<table border="1">
								<tr>
									<th>账单ID</th>
									<th>收款人</th>
									<th>收款账户</th>
									<th>开户行</th>
									<th>申请提现金额</th>
									<th>提现时间</th>
								</tr>
								@foreach($applylist2 as $v)
								<tr>
									<td>{{$v->id}}</td>
									<td>{{$v->name}}</td>
									<td>{{$v->band_card}}</td>
									<td>{{$v->band_info}}</td>
									<td>{{$v->money}}</td>
									<td>{{$v->created_at}}</td>
								</tr>
								@endforeach
							</table>
							{{ $applylist2->links()}}
							<p><input type="button" value="批量付款" class="piliang" onclick="batchAgent()"></p>
						</div>
						<div>
							<table border="1">
								<tr>
									<th>账单ID</th>
									<th>收款人</th>
									<th>收款账户</th>
									<th>账户余额</th>
								</tr>
								@foreach($nolist2 as $v)
								<tr>
									<td>{{$v->id}}</td>
									<td>{{$v->payee_name}}</td>
									<td>{{$v->band_card}}</td>
									<td>{{$v->money}}</td>
								</tr>
								@endforeach
							</table>
							{{ $nolist2->links()}}
						</div>
						<div>
							<table border="1">
								<tr>
									<th>账单ID</th>
									<th>收款人</th>
									<th>收款账户</th>
									<th>账户余额</th>
								</tr>
								@foreach($nolist2 as $v)
								<tr>
									<td>{{$v->id}}</td>
									<td>{{$v->payee_name}}</td>
									<td>{{$v->band_card}}</td>
									<td>{{$v->money}}</td>
								</tr>
								@endforeach
							</table>
							{{ $nolist2->links()}}
						</div>
					</div>
				</div>
			</div>
		</div>
	<script>
        //侧边选项卡切换
        $(function(){
            $("#div1").find("li").click(function(){
                $(".active").css("display","block");

                $(".select_ul").find("ul").css("display", "none");
                $(".select_ul").find("ul").eq($(this).index()).css("display", "block");
            });
            $(".musician").click(function(){
                $('.div1').show();
                $('.div2').hide();
            })
            $(".agency").click(function(){
                $('.div1').hide();
                $('.div2').show();
            })

        //上面选项卡切换

            $('.div1').children('div').eq(0).show().siblings('div').hide();
            $('.accomplish li').eq(0).addClass('show').siblings('li').removeClass('show');

            $('.accomplish').find('li').click(function(){
                $(this).addClass('show').siblings('li').removeClass('show');
                $('.div1').children('div').eq($(this).index()).show().siblings('div').hide();
            });

            $('.div2').children('div').eq(0).show().siblings('div').hide();
            $('.accomplish_2 li').eq(0).addClass('show').siblings('li').removeClass('show');

            $('.accomplish_2').find('li').click(function(){
                $(this).addClass('show').siblings('li').removeClass('show');
                $('.div2').children('div').eq($(this).index()).show().siblings('div').hide();
            });
        });


		function changeAction(music_action1){
            $('#action').val(music_action1);
		}
        function changeAction(music_action2) {
            $('#action').val(music_action2)
        }
        function changeAction(music_action3) {
            $('#action').val(music_action3)
        }
        function changeAction(music_action4) {
            $('#action').val(music_action4)
        }
        function changeAction(agency_action1){
            $('#action').val(agency_action1);
        }
        function changeAction(agency_action2) {
            $('#action').val(agency_action2)
        }
        function changeAction(agency_action3) {
            $('#action').val(agency_action3)
        }
        function changeAction(agency_action4) {
            $('#action').val(agency_action4)
        }

        // 提现
	    function batchMusic() {
            layer.confirm('您确定将音乐人全部提现吗？', {
                btn: ['确定','取消'] //按钮
            }, function (index, layero) {
                    $.get('http://{{$_SERVER['HTTP_HOST']}}/admin/batchMusic/', function (data) {
                        layer.msg('音乐人提现成功', {icon: 1});
                        location.reload();
                    })
                }, function(){
                layer.msg('已取消发送', {
                    time: 2000, //2s后自动关闭
                    btn: ['确定','取消']
                });
            });
		}
		function batchAgent() {
            layer.confirm('您确定将代理全部提现吗？', {
                btn: ['确定','取消'] //按钮
            }, function (index, layero) {
                    $.get('http://{{$_SERVER['HTTP_HOST']}}/admin/batchAgent/', function (data) {
                        layer.msg('代理提现成功', {icon: 1});
                        location.reload();
                    })
                }, function(){
                layer.msg('已取消发送', {
                    time: 2000, //2s后自动关闭
                    btn: ['确定','取消']
                });
            });
		}

	</script>

@endsection
